<template>
	<view class="content">
		<uni-card title="申请详情:" mode="style" :isShadow="true" note="true" :thumbnail="housePicUrl">
			<template v-slot:footer>
			    <view class="footer-box">
			        <view>申请时间: {{apply.seehouseapplicationTime}}</view>
			    </view>
				<view class="footer-box">
				    <view>申请人姓名: {{user.userName}}</view>
				</view>
				<view class="footer-box">
				    <view>房屋地点: {{house.houseProvince}}市 {{house.houseRegion}} {{house.houseDetailaddress}}</view>
				</view>
				<view class="footer-box">
				    <view>房屋卖点: {{house.houseSellpoint}}</view>
				</view>
				<view class="footer-box">
				    <view>是否同意申请: {{apply.seehouseapplicationState}}</view>
				</view>
				<view class="footer-box">
				    <view>是否已经审核: {{apply.seehouseapplicationHousestate}}</view>
				</view>
			</template>
		</uni-card>
	</view>
</template>

<script>
	import { uniList } from '@dcloudio/uni-ui'
	import { uniSearchBar } from '@dcloudio/uni-ui'
	import { uniCard } from '@dcloudio/uni-ui'
	import { mapState,mapActions } from 'vuex'
	export default {
		data() {
			return {
				housePicUrl:null,
				house:{
					houseId: 2,
					userId: 1,
					houseProvince: "重庆",
					houseCity: "重庆",
					houseRegion: "渝北",
					houseDetailaddress: "高堡湖1号10幢10-3",
					houseType: "塔楼",
					houseArea: 87,
					houseBedroomnum: 3,
					houseLivingnum: 1,
					houseFloor: 10,
					houseWedge: "普通住宅",
					houseDirection: "北",
					houseEstate: "桃香宛",
					houseElevator: 1,
					houseFitment: "精装",
					houseCreattime: 1472048779952,
					houseSellpoint: "学区房",
					houseHtype: "卧室包围客厅",
					houseTax: "无",
					houseBside: "三个学校",
					houseTraffic: "最近公交站100米",
					houseVr: 0,
					houseVrlink: null,
					houseRemark: "无",
					houseSurfaceplot: "../../static/facephoto/1.jpg",
					houseState: 1,
					houseIsdelete: 0
				},
				apply:{
					seehouseapplicationId:0,
					houseId:0,
					seehouseapplicationTime:0,
					seehouseapplicationCreattime:0,
					seehouseapplicationState:0,
					seehouseapplicationApplyerid:0,
					seehouseapplicationMerchantid:0,
					seehouseapplicationHousestate:0
				},
			}
		},
		methods: {
			
		},
		computed:{
			...mapState(['user'])
		},
		onLoad(option){
			console.log(option.seehouseapplicationId)
			this.$axios.post('getSeehouseByid',this.qs.stringify({'seehouseapplicationId':option.seehouseapplicationId}))
			.then((res)=>{
				this.apply.seehouseapplicationId = res.data.seehouse[0].seehouseapplicationId
				this.apply.houseId = res.data.seehouse[0].houseId
				var i = res.data.seehouse[0].seehouseapplicationTime
				this.apply.seehouseapplicationTime = (new Date(parseInt(i))).toLocaleDateString();
				this.apply.seehouseapplicationCreattime = (new Date(parseInt(i))).toLocaleDateString();
				
				i = res.data.seehouse[0].seehouseapplicationState
				if(i == 0){
					this.apply.seehouseapplicationState = "未同意"
				}else{
					this.apply.seehouseapplicationState = "已同意"
				}
				i = res.data.seehouse[0].seehouseapplicationHousestate
				if(i == 0){
					this.apply.seehouseapplicationHousestate  = "未审核"
				}else{
					this.apply.seehouseapplicationHousestate  = "已审核"
				}
				this.apply.seehouseapplicationApplyerid = res.data.seehouse[0].seehouseapplicationApplyerid
				this.apply.seehouseapplicationMerchantid = res.data.seehouse[0].seehouseapplicationMerchantid
				console.log(res)
				
				this.$axios.post('getHouseById',this.qs.stringify({'houseId':this.apply.houseId}))
				.then((res2)=>{
					console.log(res2)
					this.house = res2.data.houses
					console.log(this.house)
				})
				.catch(err => {
					console.log(err)
				})
				console.log(this.apply.houseId)
				this.$axios.post('getPhotos',this.qs.stringify({'houseId':this.apply.houseId}))
				.then((resPhoto)=>{
					var tempPath = resPhoto.data.photo[0].photoLocation
					this.housePicUrl = tempPath
					console.log(this.housePicUrl)
				})
				.catch(err => {
					console.log(err)
				})
			})
			.catch(err => {
				console.log(err)
			})
		}
	}
</script>

<style>
.content{
	margin-top: 40px;
}
.footer-box{
	margin-bottom: 13rpx;
	font-size: 18px;
	color: #666666;
}
</style>
